/**
 * Project Name:umale-maintenance
 * File Name:JdbcTemplateDao
 * Package Name:test.spring.data.dao.impl
 * Date: 2018/11/20 14:25
 * Copyright (c) 2018, CCI All Rights Reserved.
 */
package test.spring.data.dao.impl;

import org.springframework.jdbc.core.JdbcTemplate;
import test.spring.data.dao.Dao;
import test.spring.ioc.NewsBean;

/**
 * @author fengbo
 * @version 1.0.0
 * @date 2018/11/20 14:25
 * @since JDK 1.8
 */
public class JdbcTemplateDao implements Dao {

    private JdbcTemplate jdbcTemplate;

    @Override
    public void insert(NewsBean newsBean) {
        jdbcTemplate.update("INSERT INTO `seckill` ( " +
                " `name`, " +
                " `end_time`, " +
                " `start_time`, " +
                " `create_time`, " +
                " `update_time` " +
                " ) " +
                " VALUES " +
                " ( '" + newsBean.getName()
                + "', '" + newsBean.getBirthday()
                + "', now(), now(), now()"
                + " ) ");
    }

    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
}
